home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq15.zip
/
UPLOAD.SLT
< prev
next >
Wrap
Text File
|
1991-02-02
|
31KB
|
893 lines
//-----------------------------------------------------------
// UPLOAD.SL? Automatic upload to BBSystems.
str DIR [6] = "CAT"; // Upload log subdirectory.
//-----------------------------------------------------------
// The file <BBS>.UL must be placed in TELIX's program (main)
// directory. The name <BBS> consists of the first 8 (max.)
// alphabetic characters of the BBS name.
// The following parameters must be defined in this file:
// #:Conference number or name (optional)
// F:Filename to upload.
// D:Description of above file
// D:Description of above file (cont.)
// D:Description of above file (cont.)
// #:Conference number or name (optional)
// F:Next file to upload
// D:Description of above file
// D:Description of above file (cont.)
// D:Description of above file (cont.)
// etc.
// Example:
// #:XBOARD
// F:GAME1.ZIP
// D:Child's Play part one
// F:GAME2.ZIP
// D:Child's Play part two
// #:Main
// F:TXTFND.ZIP
// D:Text finder program
// You may specify as many files as you want. The script attempts
// to upload only the first MAXUP files. The description file is NOT
// modified (successfully uploaded files are NOT deleted from the
// list). Thus you may run the script repeatedly if you want to.
// You may also write as many specification lines as you want for
// each file. However, there are a few things you should know:
// PCBoard systems accept several lines for the description,
// but each line is limited to 45 characters.
// The files to upload must be found either in the upload or down-
// load directory defined in TELIX. If not, you MUST specify a
// directory path with the filenames. The length of a filename
// must not exceed 12 characters.
// There is no check on the line length, so be aware!
// If you have suggestions for generalizing this script without
// making it too complicated, please upload your new version to
// this BBS, or suggest improvements via old-fashioned mail to:
// Inge Vabekk
// Hamangskogen 108
// N-1300 SANDVIKA
// NORWAY
//-----------------------------------------------------------
// Hint: Define a softkey to trigger this file.
str ul_spec [12] // Upload specifications.
,upload_log [64] // Name of upload log file.
,bbs_type [24] // BBS type.
,NextConf [24] // Next conference.
,PrevConf [24] // Previous conference.
,myprot [2] // My protocol.
,hisprot [2] // His protocol.
,input [80] // Input line.
,runstr [80] // DSZ runstring.
,file [64] // Path and filename.
,description[80] // Description.
,f0 [64] // Filename for upload.
,f1 [64] // Next filename.
,command [10] // Command prompt.
,temp [4] // Temporary for short strings.
// For the Global storage:
,global []="GLOBAL" // Global script.
,join []="JOINCONF" // Join Conference script.
,bbstype []="BTYPE" // BBS type.
,short []="SHORT" // Short BBS name.
,Cprot []="CPROT" // Current protocol.
,Hprot []="HPROT" // "His" protocol.
,version []="PCBVER" // PCB version
,conf []="CONF" // Current conference
,prompt []="PROMPT" // Current command prompt.
,maxup []="MAXUP" // Max no. of files to upload
,dsz []="DSZ" // DSZ parameters.
;
int tol = 600 // timeout limit is one minute.
,tmark, stat
,infile // Input file pointer
,fstat // Input file status:
// 0: Description in "description"
// >0: Length of filename in f0 or f1
// <0: EOF read.
,infilemenu // in file menu if TRUE.
,dline // Description line number
,pcb, mbbs, rbbs, opus, fido, crcs // Possible BBS types
,PCBver // PCB version.
,switched // TRUE if conference switched.
,max // max. no. of files to upload.
,protocol // Must be INT!
,usedsz // = 1 (true) if we're using DSZ.
;
//-----------------------------------------------------------
// Upload script is entered here.
//-----------------------------------------------------------
main()
{
int d, i, k, l;
entry(); // Updates colors & status bar.
// Check if online.
//-----------------------------------------------------------
if (!carrier())
{ status_wind ("YOU CAN ONLY UPLOAD IF YOU'RE ONLINE!",20);
return(-1);
}
newdir (_telix_dir); // Move to TELIX dir.
// Find BBS type (Set one logical variable).
read (bbstype,input); // Get BBS type.
mbbs = pcb = rbbs = opus = fido = crcs = 0;
if (input == "MBBS") mbbs = 1;
else if (input == "PCB" )
{ pcb = 1;
read (version,temp);
PCBver = stoi (temp); // Get PCBoard version
}
else if (input == "RBBS") rbbs = 1;
else if (input == "OPUS") opus = 1;
else if (input == "FIDO") fido = 1;
else if (input == "CRCS") crcs = 1;
else
{ wrongBBS(); // Doesn't match script!
return (-1);
}
read (short,ul_spec); // Get the BBS's short name.
read (prompt,command); // Get command prompt.
read (cprot,myprot); // Get my and
protocol = subchr (myprot,0);
read (hprot,hisprot); // his protocol character.
read (conf,PrevConf); // Get conference.
if (pcb) NextConf = "Main Board"; // Join Main conference.
// Construct name of upload log and upload spec files.
//-----------------------------------------------------------
run ("CRDIR",DIR,2); // Create directory if necessary.
upload_log = DIR; // Set directory.
strcat (upload_log,"\");
strcat (upload_log,ul_spec); // Add BBS name.
strcat (ul_spec,".UL"); // Add extension.
// Read upload specs.
infile = fopen (ul_spec,"r"); // Read from upload spec.file.
if (infile==0) goto done; // No such file!
// Start uploading.
//-----------------------------------------------------------
if (read (dsz,runstr) > 0 // Are we using DSZ?
&& protocol == 'Z')
{ strcat (runstr," sz "); // Add parameters.
usedsz = 1;
}
else // No.
usedsz = 0;
i = fstat = 0;
read (maxup,temp);
MAX = stoi (temp);
while (i < MAX && carrier()) // Upload files
{ while (!fstat) // Make sure a filename has
filename(); // been read.
if (UL()) ++i; // If upload OK, count file.
if (fstat<0) i = MAX; // Quit if EOF read.
}
fclose (infile); // Close the specification file.
done:
if (!carrier()) return (-1); // Carrier lost...
fdelete (ul_spec); // Delete the upload file.
if (mbbs && infilemenu) // In the file menu, MBBS:
{ waitfor (command,2);
cputs ("Q^M"); // Quit.
}
else
flush();
return (0);
}
//-----------------------------------------------------------
// Routine to check if file exists and perform upload.
//-----------------------------------------------------------
// The routine returns zero for unsuccessful, and one for a
// successful upload.
// No message is given for files not found!
UL()
{
int ok, error;
if (filename()) return (0); // Return if no description.
if (strchr(f1,0,'\') > 0)
file = f1; // Directory specified.
else
{ file = _up_dir; // Not specified:
strcat (file,f1);